package cn.wolfcode.service.impl;


import cn.wolfcode.domain.Dept;
import cn.wolfcode.mapper.DeptMapper;
import cn.wolfcode.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;


@Service
public class DeptServiceImpl  implements DeptService {
    @Autowired
    private DeptMapper deptMapper;


    @Override
    public List<Dept> list() {
        return  deptMapper.list();
    }

    @Override
    public Dept getById(Long id) {
            return deptMapper.getById(id);
    }

    @Override
    public void add(Dept dept) {
        dept.setCreateTime(new Date());
        dept.setUpdateTime(new Date());
        deptMapper.add(dept);
    }

    @Override
    public void update(Dept dept) {
        dept.setUpdateTime(new Date());
        deptMapper.update(dept);
    }

    @Override
    public void delete(Long id) {
        deptMapper.delete(id);
    }
}
